# Maintainer: David Runge <dvzrv@archlinux.org>

_name=ansible-vim
pkgname=vim-ansible
pkgver=3.4
pkgrel=1
pkgdesc="A vim plugin for syntax highlighting Ansible's common filetypes"
arch=(any)
url="https://github.com/pearofducks/ansible-vim"
license=(
  BSD
  MIT
)
groups=(vim-plugins)
depends=(
  python-jinja
  vim-plugin-runtime
)
makedepends=(
  ansible
  python
)
optdepends=('vim-ultisnips: for ansible snippets')
source=($url/archive/$pkgver/$_name-$pkgver.tar.gz)
sha512sums=('c301663e54c7724ff6cc268d4254c96fa7b100860b87584e6615b778a9b8f9e6839d207be6b765c2e85362104a8336e119dfdef995173f48d2f2b108762b6d90')
b2sums=('7fed011b0eefcae16d5e6688fe722c37e43b43445288affb652fbefe9e183469965c2aa97fa27dcddcb866a08d8f9ba438d931ff1698d6bb4105f1dfe8a35999')

build() {
  cd $_name-$pkgver
  # generating a reproducible UltiSnips snippet file:
  # https://github.com/pearofducks/ansible-vim/pull/105
  python UltiSnips/generate.py --style=dictionary
}

package() {
  cd $_name-$pkgver
  install -vDm 644 ftdetect/*.vim -t "$pkgdir/usr/share/vim/vimfiles/ftdetect/"
  install -vDm 644 ftplugin/*.vim -t "$pkgdir/usr/share/vim/vimfiles/ftplugin/"
  install -vDm 644 indent/*.vim -t "$pkgdir/usr/share/vim/vimfiles/indent/"
  install -vDm 644 syntax/*.vim -t "$pkgdir/usr/share/vim/vimfiles/syntax/"
  install -vDm 644 ansible.snippets -t "$pkgdir/usr/share/vim/vimfiles/UltiSnips/"
  install -vDm 644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
  install -vDm 644 syntax/*.vim_LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
  install -vDm 644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
}
